package com.idroc.coelacanth.core.membership;

import java.io.Serializable;

/**
 * 节点的心跳状态
 * @author yuyoo (yuyoo4j@163.com)
 * @date 2009-12-2 上午11:12:56
 */
@SuppressWarnings("serial")
public class HeartBeatState implements Serializable {
	
	/**
	 * 心跳版本号
	 */
	private long pulseVersion = 0;
	
	/**
	 * 节点发生心跳的时间(以发送心跳节点主机时间)
	 */
	private long pulseTime = -1;
	
	/**
	 * 获取心跳的时间(以接受心跳的节点的主机时间)
	 */
	private long apperceiveTime = -1;
	
	/**
	 * 心跳状态的有效期(生命周期)
	 */
	private long lifecycle = -1;

	public long getPulseVersion() {
		return pulseVersion;
	}

	public void setPulseVersion(long pulseVersion) {
		this.pulseVersion = pulseVersion;
	}

	public long getPulseTime() {
		return pulseTime;
	}

	public void setPulseTime(long pulseTime) {
		this.pulseTime = pulseTime;
	}

	public long getApperceiveTime() {
		return apperceiveTime;
	}

	public void setApperceiveTime(long apperceiveTime) {
		this.apperceiveTime = apperceiveTime;
	}

	public long getLifecycle() {
		return lifecycle;
	}

	public void setLifecycle(long lifecycle) {
		this.lifecycle = lifecycle;
	}
	
	@Override
	public String toString() {
		
		StringBuilder sb = new StringBuilder();
		sb.append("HeartBeatState[");
		sb.append("pulseVersion:").append(pulseVersion).append(",");
		sb.append("pulseTime:").append(pulseTime).append(",");
		sb.append("lifecycle:").append(lifecycle).append(",");
		sb.append("apperceiveTime:").append(apperceiveTime);
		sb.append("]");
		return sb.toString();
	}
}
